package pers.zc.activiti.scheduling;

import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.support.CronTrigger;

import java.util.Date;

/**
 * @description 任务类
 * @Author Lin FuYuan
 * @date 2020/4/3
 */
public class SchduleTrigger implements Trigger {
    private TaskEntity taskEntity;
    public SchduleTrigger(TaskEntity taskEntity){
        this.taskEntity = taskEntity;
    }
    @Override
    public Date nextExecutionTime(TriggerContext triggerContext) {
        Date date = new CronTrigger(taskEntity.getCorn()).nextExecutionTime(triggerContext);
        return date;
    }



}
